package com.jmu.employee;

import java.util.Comparator;

public class ComplexComparator implements Comparator<Staff> {
    //比较年龄与薪水
    @Override
    public int compare(Staff o1, Staff o2) {
        if (o1.getAge() > o2.getAge())
            return 1;
        else if (o1.getAge() < o2.getAge())
            return -1;
        else if (o1.getSalary() > o2.getSalary())
            return 1;
        else if (o1.getSalary() < o2.getSalary())
            return -1;
        return 0;
    }
}
